home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / tcsel003.zip / BITMAP.PAS < prev    next >
Pascal/Delphi Source File  |  1992-10-16  |  871b  |  31 lines

  1. type
  2.   map = array[0..maxsize] of byte;
  3.  
  4. function BitSetInBitMap(var x; numb : longint): boolean;
  5.   { Tests the numb bit in the bitmap array }
  6.   var m: map absolute x;
  7.   begin
  8.     BitSetInBitMap := odd(m[numb shr 3] shr (numb and 7));
  9.   end;
  10.  
  11. procedure SetBitInBitMap(var x; numb: word);
  12.   { Sets the numb bit in the bitmap array }
  13.   var m: map absolute x;
  14.   begin
  15.     m[numb shr 3] := m[numb shr 3] or (1 shl (numb and 7))
  16.   end;
  17.  
  18. procedure ResetBitInBitMap(var x; numb : longint);
  19.   { Resets the numb bit in the bitmap array }
  20.   var m: map absolute x;
  21.   begin
  22.    m[numb shr 3] := m[numb shr 3] and not(1 shl (numb and 7));
  23.   end;
  24.  
  25. procedure ToggleBitInBitMap(var x; numb : longint);
  26.   { Toggles (flips) the numb bit in the bitmap array }
  27.   var m: map absolute x;
  28.   begin
  29.     m[numb shr 3] := m[numb shr 3] xor (1 shl (numb and 7));
  30.   end;
  31.